package com.huxim123.hiddensettingsinm9;

import android.app.ListActivity;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;

public class HiddenSettingsinM9 extends ListActivity 
{
    /** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) 
	{
	  super.onCreate(savedInstanceState);

	  String[] meuns = getResources().getStringArray(R.array.meuns_array);
	  setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, meuns));
	  //setContentView(R.layout.main);
	  
	  ListView lv = getListView();
	  lv.setTextFilterEnabled(true);

	  lv.setOnItemClickListener(new OnItemClickListener() 
	  {
	    /* (non-Javadoc)
	     * @see android.widget.AdapterView.OnItemClickListener#onItemClick(android.widget.AdapterView, android.view.View, int, long)
	     */
	    public void onItemClick(AdapterView<?> parent, View view, int position, long id) 
	    {
	      // When clicked, show a toast with the TextView text
	      //Toast.makeText(getApplicationContext(), ((TextView) view).getText(), Toast.LENGTH_SHORT).show();
	      
	      if (id == 0)
	      {
	    	  Intent aIntent = new Intent("android.settings.SYNC_SETTINGS");
	    	  startActivityForResult(aIntent,0);
	      }
	      else if (id == 1)
	      {
	    	  Intent sIntent = new Intent();
	    	  sIntent.setClassName("com.android.settings", "com.android.settings.RunningServices");
	    	  startActivity(sIntent);
	      }
	      else if (id == 2)
	      {
	    	Intent wIntent = new Intent("/");
	        ComponentName wcomp = new ComponentName("com.android.settings","com.android.settings.WirelessSettings");
	        wIntent.setComponent(wcomp);
	        wIntent.setAction("android.intent.action.VIEW");
	        startActivityForResult(wIntent,0);
	    	//System.exit(0);
	      }
	      else if (id == 3)
	      {
	    	  Intent dIntent = new Intent();
	    	  dIntent.setClassName("com.android.settings", "com.android.settings.DeviceAdminSettings");
	    	  startActivity(dIntent);
	      }
	      /*else if (id == 4)
	      {
	    	  Intent pIntent = new Intent();
	    	  pIntent.setClassName("com.android.settings", "com.android.settings.ProxySelector");
	    	  startActivity(pIntent);
	      }*/
	    }
	  });
	  
	}
	
}